package org.rambadger.command.event;

import com.google.common.base.Objects;

import java.io.Serializable;

public abstract class FileDeleted {
    public static class SubmissionFileDeleted extends FileDeleted implements Serializable {
        private static final long serialVersionUID = -2414427667346592330L;
        //Compound Key {
        final String submitterId;
        final int submissionId;
        //}
        final String filename;

        public SubmissionFileDeleted(String submitterId, int submissionId, String filename) {
            this.submitterId = submitterId;
            this.submissionId = submissionId;
            this.filename = filename;
        }

        public String getFullSubmissionId() {
            return submitterId+"/"+submissionId;
        }

        public String getSubmitterId() {
            return submitterId;
        }

        public int getSubmissionId() {
            return submissionId;
        }

        public String getFilename() {
            return filename;
        }

        @Override
        public String toString() {
            return Objects.toStringHelper(this)
                    .add("submitterId", submitterId)
                    .add("submissionId", submissionId)
                    .add("filename", filename)
                    .toString();
        }
    }

    public static class AssignmentFileDeleted extends FileDeleted implements Serializable {
        private static final long serialVersionUID = 2570841091977847455L;

        //Compound Key {
        final String platformId;
        final String assignmentId;
        //}
        final String filename;

        public AssignmentFileDeleted(String platformId, String assignmentId, String filename) {
            this.platformId = platformId;
            this.assignmentId = assignmentId;
            this.filename = filename;
        }

        public String getFullAssignmentId() {
            return platformId+"/"+assignmentId;
        }

        public String getPlatformId() {
            return platformId;
        }

        public String getAssignmentId() {
            return assignmentId;
        }

        public String getFilename() {
            return filename;
        }

        @Override
        public String toString() {
            return Objects.toStringHelper(this)
                    .add("platformId", platformId)
                    .add("assignmentId", assignmentId)
                    .add("filename", filename)
                    .toString();
        }
    }

    public static class UserPortraitRemoved extends FileDeleted implements Serializable{
        private static final long serialVersionUID = -308142865357057017L;

        final String username;

        public UserPortraitRemoved(String username) {
            this.username = username;
        }

        public String getUsername() {
            return username;
        }

        @Override
        public String toString() {
            return Objects.toStringHelper(this)
                    .add("username", username)
                    .toString();
        }
    }
}
